function [Z,makespan,pvals,GG,VV] = fitness(chroms,FF)
global  num_machine num_job num_op volumn;
WP=[1.8,1.6,2.0,2.4,4.1,2.6,3.2,2.6,2.8,1.3,4.0,3.5,1.9,3.7,2.4];
EP=[0.6,0.5,0.6,0.8,1.3,0.8,1.1,0.8,0.9,0.4,1.3,1.2,.7,1.4,0.9];
sizepop=size(chroms,1);
pvals=cell(1,sizepop);
makespan=zeros(1,sizepop); 
Q=zeros(1,sizepop);
total_op_num=sum(num_op);  
machine_weight=zeros(1,sizepop);
key_machine=zeros(1,sizepop);
for k=1:sizepop
    chrom=chroms(k,:);
    machine=zeros(1,num_machine);  
    job=zeros(1,num_job);  
    machine_time=zeros(1,num_machine);  
    pval=zeros(2,total_op_num);  
    for i=1:total_op_num
        if machine(chrom(total_op_num+i))>=job(chrom(i))
            pval(1,i)=machine(chrom(total_op_num+i)); 
            machine(chrom(total_op_num+i))=machine(chrom(total_op_num+i))+chrom(total_op_num*2+i);
            job(chrom(i))=machine(chrom(total_op_num+i));
            pval(2,i)=machine(chrom(total_op_num+i)); 
        else
            pval(1,i)=job(chrom(i));
            job(chrom(i))=job(chrom(i))+chrom(total_op_num*2+i);
            machine(chrom(total_op_num+i))=job(chrom(i));
            pval(2,i)=job(chrom(i));
        end
        machine_time(chrom(total_op_num+i))=machine_time(chrom(total_op_num+i))+chrom(total_op_num*2+i);
    end
    makespan(k)=max(machine);
    machine_weight(k)=sum(machine_time);
     key_machine(k)=max(machine_time);
    for i=1:num_machine
        Q(k)=WP(i)*machine(i)+EP(i)*(machine(i)-machine_time(i))+Q(k);
    end
    pvals{k}=pval;
end
f1=(makespan-FF(2))/(FF(1)-FF(2));
f2=(Q-FF(4))/(FF(3)-FF(4));
f3=(machine_weight-FF(6))/(FF(5)-FF(6));
f4=(key_machine-FF(8))/(FF(7)-FF(8));
Z=volumn(1)*f1+volumn(2)*f2+volumn(3)*f3+volumn(4)*f4;
GG=[f1;f2;f3;f4];
GG=GG.' ;
VV=[makespan;Q;machine_weight;key_machine];
end